import os

from PIL import Image

fileName = os.listdir('D:/Inspur/济宁如意纺织/imagesdataset/异色纱/')

width = 1024

height = 1024

os.mkdir('D:/Inspur/济宁如意纺织/imagesdataset/异色纱1/')

for img in fileName:
    pic = Image.open('D:/Inspur/济宁如意纺织/imagesdataset/异色纱/' + img)

    newpic = pic.resize((width, height), Image.ANTIALIAS)

    print(newpic)

    newpic.save('D:/Inspur/济宁如意纺织/imagesdataset/异色纱1/' + img)
